/* 
 * File:   picker.cpp
 * Author: sergey
 *
 * Created on 19 Декабрь 2009 г., 0:14
 */
#include <fstream>
#include <vector>
#include <sstream>
#include <string>
#include "DefineConfiguration.h"
#include "LibraryInterface.h"
#include "NLLibrary.h"

const UInt8 n = 5;
const UInt8 sto = 0,eno = 5;
typedef LibraryInfo<n> CurLibInfo;

int main(int argc, char** argv) {
    std::ostringstream filename;
    
    std::fstream *output;
    output = new std::fstream[eno-sto];
    for(size_t i = 0; i < eno - sto; i++) {
        filename << LIBRARYDIRECTORIES << "/fulllibs/fulllibrary_" << n << "_" << (i + sto) << ".bin";
        output[i].open(filename.str().c_str(), std::ios::out | std::ios::binary);
        filename.str("");
    }

    NLLibrary<CurLibInfo> nllib;
    filename << LIBRARYDIRECTORIES << "/nllibs/nllibrary_" << CurLibInfo::n << ".bin";
    nllib.load(filename.str());


    for(UInt64 f = 0; f < CurLibInfo::fC; f++) {
        UInt8 s;
        nllib.get(f, s);
        if (s >= sto && s < eno)
            output[s - sto].write((char*)&f, sizeof(UInt64));
        
    }

    for(size_t i = 0; i < eno - sto; i++)
        output[i].close();
    
    return (0);
}

